package com.sczmgk.hotline_pzh.ui;

import android.content.Intent;
import android.os.Bundle;
import android.os.Message;
import android.view.View;
import android.widget.TextView;

import com.sczmgk.hotline_pzh.R;
import com.sczmgk.hotline_pzh.base.BaseActivity;
import com.sczmgk.hotline_pzh.constants.Constants;
import com.sczmgk.hotline_pzh.entity.MyMessageBean.MessageInfo;

/**
 * Created by Administrator on 2016/12/8 0008.
 */

public class MessageActivity extends BaseActivity {

    /*传递过来的我的消息的信息*/
    private MessageInfo msgInfos;

    /*我的消息的标题*/
    private TextView mTvTitle;

    /*我的消息的内容*/
    private TextView mTvContent;

    /*我的消息的时间*/
    private TextView mTvTime;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_message);

        //获取传递的消息对象
        Intent intent = getIntent();
        Bundle bundle = intent.getExtras();
        msgInfos = (MessageInfo) bundle.getSerializable(Constants.MESSAGE_DETAIL);

        setHeader();

        initView();

        initData();

        setListener();
    }

    /**
     * 设置标题栏
     */
    private void setHeader() {

        //根据类型设置标题
        if (msgInfos.type == 1) {
            setTitle(R.string.system_message);
        }else{
            setTitle(R.string.my_message);
        }
        setLeftBtnVisibility(View.VISIBLE);
    }

    /**
     * 初始化控件
     */
    private void initView() {

        //标题
        mTvTitle = (TextView) findViewById(R.id.tv_msg_title);
        //内容
        mTvContent = (TextView) findViewById(R.id.tv_msg_content);
        //时间
        mTvTime = (TextView) findViewById(R.id.tv_msg_time);
    }

    /**
     * 初始化数据
     */
    private void initData() {
        mTvTitle.setText(msgInfos.title);
        mTvContent.setText(msgInfos.description);
        mTvTime.setText(msgInfos.publishtime);
    }

    /**
     * 设置监听
     */
    private void setListener() {

    }


    @Override
    public void handleMessage(Message msg) {

    }

    @Override
    public boolean getIsNeedLogin() {
        return true;
    }
}
